import { defineStore } from 'pinia'
import { Names } from './store-name'






type User = {
    name:string,
    current:number
}
let result:User = {
    name:'飞机',
    current:1
} 

// const Login = (): Promise<Name> => {
//     return new Promise((resolve) => {
//     setTimeout(() => {
//     resolve({
//     name: '小满',
//     current: 1
//     })
//     }, 2000)
//     })
//     }

// 参数1：id
export const useTestStore = defineStore(Names.Test, {
    state:()=>{
        return {
        current:"",
        user:<User>{},
        name:"",
        history:[],
        token:""
    }
    },
    // 可以操作state
    getters:{
    },
    //可以操作异步 和 同步提交state
    actions:{
        // setCurrent () {
        //     // this函数
        //     this.current++
    //     async getLoginInfo() {
    //         const result = await Login()
    // this.name = result
    //     },
// setUser(){
//     this.user = result
// }

    }
})